//
//  HTWaybillStateCell.m
//  TruckDriver
//
//  Created by Ting Han on 2017/9/29.
//  Copyright © 2017年 Ting Han. All rights reserved.
//

#import "HTWaybillStateCell.h"
#import "UIImageView+WebCache.h"

@interface HTWaybillStateCell()
@property (weak, nonatomic) IBOutlet UILabel *startLabel;
@property (weak, nonatomic) IBOutlet UILabel *endLabel;
@property (weak, nonatomic) IBOutlet UILabel *goodsType;
@property (weak, nonatomic) IBOutlet UILabel *goodsWeight;
@property (weak, nonatomic) IBOutlet UILabel *truckLength;
@property (weak, nonatomic) IBOutlet UILabel *waybillOrderidLabel;
@property (weak, nonatomic) IBOutlet UILabel *orderTimeLabel;
@property (weak, nonatomic) IBOutlet UILabel *nameLabel;
@property (weak, nonatomic) IBOutlet UILabel *phoneLabel;
@property (weak, nonatomic) IBOutlet UILabel *idCardLabel;
@property (weak, nonatomic) IBOutlet UIImageView *headImageView;

@end

@implementation HTWaybillStateCell

- (void)setWaybillDetialModel:(HTWaybillDetialModel *)waybillDetialModel{
    _waybillDetialModel = waybillDetialModel;
    //bg_headsculpture
    [self.headImageView sd_setImageWithURL:[NSURL URLWithString:waybillDetialModel.picurl] placeholderImage:[UIImage imageNamed:@"bg_headsculpture"]options:SDWebImageRefreshCached];
    self.startLabel.text = waybillDetialModel.startname;
    self.endLabel.text = waybillDetialModel.endname;
    
    self.truckLength.text  = [HTUtils sortLengthDisplayStringWith:waybillDetialModel.height];
     self.goodsType.text = waybillDetialModel.cartype;
    if (waybillDetialModel.cartype == nil || waybillDetialModel.cartype.length <= 0) {
         self.goodsType.text = @"不限类型";
    }
    NSString *unit= [waybillDetialModel.unti integerValue] == 1 ? @"吨":@"方";
    self.goodsWeight.text = [NSString stringWithFormat:@"%@%@",waybillDetialModel.weight,unit];
    self.orderTimeLabel.text = [HTUtils timeIntervalExchange:waybillDetialModel.createtime];
    self.waybillOrderidLabel.text = waybillDetialModel.orderid;
    self.nameLabel.text = waybillDetialModel.drivername;
    self.phoneLabel.text = waybillDetialModel.phones;
    self.idCardLabel.text = waybillDetialModel.carnum;
}
- (void)awakeFromNib {
    [super awakeFromNib];
    // Initialization code
    self.headImageView.layer.masksToBounds = YES;
    self.headImageView.layer.cornerRadius = 22.5;
}

- (void)setSelected:(BOOL)selected animated:(BOOL)animated {
    [super setSelected:selected animated:animated];

    // Configure the view for the selected state
}

@end
